import { onMounted,ref } from "vue";
import { getErCategoryAPI } from "@/apis/subCategory";

import { useRoute,onBeforeRouteUpdate } from "vue-router";


export function useSubCategory() {
    const SubCategoryData = ref([])
    const route = useRoute()

    const getSubCategory = async () => {
        const res = await getErCategoryAPI(route.params.id)
        SubCategoryData.value = res.result
        console.log(res.result)
    }

    onMounted(() => {
        getSubCategory()
    })


    return {
        SubCategoryData
    }
}